{
	template:`
	<a-page-header :title="method.title" :sub-title="method.description">
		<template #extra>
			<m-back @click="back(false);">关闭</m-back>
		</template>
		<a-card :hoverable="true" :bodyStyle="{padding:'20px'}">
            <a-list size="small">
                <a-list-item>
                    <a-list-item-meta>
                        <template #title>
                            <a-typography-paragraph :copyable="{text:method.path}">
                                接口地址：{{method.path}}
                            </a-typography-paragraph>
                        </template>
                    </a-list-item-meta>
                    <div v-if="method.permission" style="width:400px">
                        <a-row type="flex" align="middle">
                            <a-col flex="100px">
                                Authorization:
                            </a-col>
                            <a-col flex="auto">
                                <a-input v-model:value="header['Authorization']" style="width:300px;" />
                            </a-col>
                        </a-row>
                    </div>
                </a-list-item>
                <a-list-item v-for="item in method.params">
                    <a-list-item-meta>
                        <template #title>
                            <span v-if="item.notnull" style="color:#f00;">*</span>{{item.name}}
                            &nbsp;{{item.description}}
                            <a-tag size="small">{{item.type}}{{item.type=='STRING'?('('+item.length+')'):''}}</a-tag>
                            <a-tag size="small" color="processing" v-if="item.dictType">
                                <a-popover ><template #content>{{item.dictType}}</template>字典</a-popover>
                            </a-tag>
                            <a-tag size="small" color="processing" v-if="item.dictOption">
                                <a-popover ><template #content>{{item.dictOption}}</template>选项</a-popover>
                            </a-tag>
                        </template>
                    </a-list-item-meta>
                    <div style="width:300px">
                        <a-select v-if="item.dictType||item.dictOption" :options="dictOptions(item.dictType||('@'+item.dictOption))" v-model:value="model[item.name]" @change="formatSendModel" show-search :filter-option="selectFilter" style="width:100%"/>
                        <a-date-picker v-else-if="item.type=='DATE'" v-model:value="model[item.name]" @change="formatSendModel" format="YYYY-MM-DD HH:mm:ss" valueFormat="YYYY-MM-DD HH:mm:ss" style="width:100%" />
                        <a-input-number v-else-if="item.type=='DOUBLE'||item.type=='INT'" v-model:value="model[item.name]" @change="formatSendModel" style="width:100%"/>
                        <a-input v-else v-model:value="model[item.name]" @change="formatSendModel" />
                    </div>
                </a-list-item>
                <a-list-item>
                    <a-list-item-meta>
                    </a-list-item-meta>
                    <template #actions>
                        <a-popover title="修改参数" trigger="click" placement="leftTop" @openChange="inputParamHandler">
                            <template #content>
                                <a-textarea v-model:value="sendJson" style="width:500px;" :auto-size="{ minRows: 3, maxRows: 15 }"/>
                            </template>
                            <a-button type="link">修改参数</a-button>
                        </a-popover>
                        <a-popconfirm title="请求确认" @confirm="doRequest" placement="left">
                            <a-button type="primary">请求</a-button>
                        </a-popconfirm>
                    </template>
                </a-list-item>
            </a-list>
            <div>
                <a-row :gutter="16">
                    <a-col :span="10">
                        <a-divider orientation="left" style="margin-top:0;">请求数据</a-divider>
                        <div v-if="header['Authorization']">{{header['Authorization']}}</div>
                        <json-val :json-val="sendModel" :current-depth="0" :max-depth="2" :last="true"></json-val>
                    </a-col>
                    <a-col :span="14">
                        <a-divider orientation="left" style="margin-top:0;">结果</a-divider>
                        <div v-if="returnMsg">{{returnMsg}}</div>
                        <json-val :json-val="returnModel" :current-depth="0" :max-depth="2" :last="true"></json-val>
                    </a-col>
                </a-row>
            </div>
		</a-card>
	</a-page-header>
	`,
	props: ['localeZh','param','parentVue'],
	data:function(){
		return {
		    method:{},
		    model:{},
		    header:{},
		    sendJson:'{}',
		    sendModel:{},
		    returnModel:{},
		    returnMsg:''
		};
	},
	mounted(){
	    this.method=this.param.method;
	    this.formatSendModel();
	},
	methods:{
	    formatSendModel:function(){
            this.sendModel={};
            for(let k in this.model){
                mo.fn.fillJSONData(this.sendModel,k,this.model[k]);
            }
	    },
	    doRequest:function(){
            let qtime=new Date().getTime();
	        this.requestData(this.method.path,this.sendModel,(json)=>{
	            this.returnMsg='请求耗时：'+formatNumber((new Date().getTime()-qtime)/1000,'#,##0.000')+'秒';
	            this.returnModel=json;
	        },false,this.header);
	    },
	    inputParamHandler:function(v){
	        if(v){
	            this.inputParamFocus();
	        }else{
	            this.inputParamBlur();
	        }
	    },
	    inputParamFocus:function(){
	        this.sendJson=JSON.stringify(this.sendModel,null,2);
	    },
	    inputParamBlur:function(){
	        try{
                var obj = JSON.parse(this.sendJson);
                if(typeof obj=='object'){
                    this.sendModel=obj;
                    return;
                }
	        }catch(e){}
	        this.remind().error("转换错误");
	    }
	}
}